package com.idealighter.game.web.checklevel.laba.controller;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.idealighter.game.core.result.Result;
import com.idealighter.game.web.checklevel.laba.controller.convert.LaBaCheckResultDtoConvert;
import com.idealighter.game.web.checklevel.laba.controller.dto.LaBaIconInputDto;
import com.idealighter.game.web.checklevel.laba.service.LaBaBasicControlCheck;
import com.idealighter.game.web.checklevel.laba.service.bo.LaBaCheckResultBo;
import com.idealighter.utils.json.JsonUtil;
import java.util.List;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

@Path("/checkLevel/laba")
@Singleton
public class LaBaCheckLevelController {
  @Inject
  private LaBaBasicControlCheck laBaBasicControlCheck;

  /**
   * .
   * 
   * @param icongs .
   * @return .
   */
  @Produces("application/json; charset=utf-8")
  @POST
  public Result checkBasic(@FormParam("icongs") String icongs) {
    // 水果拉霸基础档位测试
    List<LaBaIconInputDto> basicInputs = JsonUtil.fromJsonToList(icongs, LaBaIconInputDto.class);
    List<LaBaCheckResultBo> checkResult = laBaBasicControlCheck.check(basicInputs);
    Result result = new Result(true);
    result.getMap().put("list", LaBaCheckResultDtoConvert.INSTANCE.bo2dto(checkResult));
    return result;
  }
}
